// A simple program that computes the square root of a number
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <config.h>
#include <version.h>

#ifdef USE_MYMATH
#include "myMath.h"
#endif 

int a __attribute__((section("CustormSectionForA"))) = 100;

int main (int argc, char *argv[])
{

  printf("%s version %02d-%02d-%02d built by %s\r\n", 
      argv[0], V_MAJOR, V_MINOR, V_PATCH, USER);
  if (argc < 2)
  {
    fprintf(stdout,"Usage: %s number\n",argv[0]);
    return 1;
  }

  #ifdef HAVE_LOG
  printf("Has log function!\r\n");
  #else
  printf("Does not have log function!\r\n");
  #endif

  #ifdef HAVE_MALLOC
  printf("Has malloc function!\r\n");
  #else
  printf("Does not have malloc function!\r\n");
  #endif


  double inputValue = atof(argv[1]);
  #ifdef USE_MYMATH
  double outputValue = mysqrt(inputValue);
  #else
  double outputValue = sqrt(inputValue);
  #endif 
  fprintf(stdout,"The square root of %g is %g\n",
    inputValue, outputValue);


  
#ifdef PATH
    fprintf(stdout, "source path %s\n", PATH);
#endif


  return 0;
}

